.class public Lcom/zuimeia/sdk/download/utils/ToastUtil;
.super Ljava/lang/Object;
.source "ToastUtil.java"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 22
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static hasSmartBar()Z
    .registers 5

    .prologue
    const/4 v2, 0x0

    .line 67
    invoke-static {}, Lcom/zuimeia/sdk/download/utils/ToastUtil;->isMeizu()Z

    move-result v1

    if-nez v1, :cond_9

    move v1, v2

    .line 80
    .local v0, "method":Ljava/lang/reflect/Method;
    :goto_8
    return v1

    .line 72
    .end local v0    # "method":Ljava/lang/reflect/Method;
    :cond_9
    :try_start_9
    const-string v1, "android.os.Build"

    invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v1

    const-string v3, "hasSmartBar"

    const/4 v4, 0x0

    new-array v4, v4, [Ljava/lang/Class;

    invoke-virtual {v1, v3, v4}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    .line 73
    .restart local v0    # "method":Ljava/lang/reflect/Method;
    const/4 v1, 0x0

    const/4 v3, 0x0

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v3}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Boolean;

    invoke-virtual {v1}, Ljava/lang/Boolean;->booleanValue()Z
    :try_end_25
    .catch Ljava/lang/Exception; {:try_start_9 .. :try_end_25} :catch_27

    move-result v1

    goto :goto_8

    .line 74
    :catch_27
    move-exception v1

    .line 77
    sget-object v1, Landroid/os/Build;->DEVICE:Ljava/lang/String;

    const-string v3, "mx"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_3c

    sget-object v1, Landroid/os/Build;->DEVICE:Ljava/lang/String;

    const-string v3, "m9"

    invoke-virtual {v1, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3e

    :cond_3c
    move v1, v2

    .line 78
    goto :goto_8

    .line 80
    :cond_3e
    const/4 v1, 0x1

    goto :goto_8
.end method

.method public static isMeizu()Z
    .registers 4

    .prologue
    const/4 v1, 0x0

    .line 58
    sget-object v0, Landroid/os/Build;->BRAND:Ljava/lang/String;

    .line 59
    .local v0, "brand":Ljava/lang/String;
    if-nez v0, :cond_6

    .line 63
    :cond_5
    :goto_5
    return v1

    :cond_6
    sget-object v2, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-virtual {v0, v2}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "meizu"

    invoke-virtual {v2, v3}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v2

    const/4 v3, -0x1

    if-le v2, v3, :cond_5

    const/4 v1, 0x1

    goto :goto_5
.end method

.method public static showToast(Landroid/content/Context;I)V
    .registers 4
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "textRes"    # I

    .prologue
    .line 25
    invoke-virtual {p0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    invoke-static {p0, v0, v1}, Lcom/zuimeia/sdk/download/utils/ToastUtil;->showToast(Landroid/content/Context;Ljava/lang/String;I)V

    .line 26
    return-void
.end method

.method public static showToast(Landroid/content/Context;II)V
    .registers 4
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "textRes"    # I
    .param p2, "toastDuration"    # I

    .prologue
    .line 29
    invoke-virtual {p0, p1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0, v0, p2}, Lcom/zuimeia/sdk/download/utils/ToastUtil;->showToast(Landroid/content/Context;Ljava/lang/String;I)V

    .line 30
    return-void
.end method

.method public static showToast(Landroid/content/Context;Ljava/lang/String;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "text"    # Ljava/lang/String;

    .prologue
    .line 33
    const/4 v0, 0x0

    invoke-static {p0, p1, v0}, Lcom/zuimeia/sdk/download/utils/ToastUtil;->showToast(Landroid/content/Context;Ljava/lang/String;I)V

    .line 34
    return-void
.end method

.method public static showToast(Landroid/content/Context;Ljava/lang/String;I)V
    .registers 11
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "text"    # Ljava/lang/String;
    .param p2, "duration"    # I

    .prologue
    const/16 v7, 0x50

    const/4 v6, 0x0

    .line 37
    invoke-static {p0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v3

    sget v4, Lcom/zuimeia_sdk_download/downloadprovider/R$layout;->zuimeia_sdk_download_layout_toast:I

    const/4 v5, 0x0

    invoke-virtual {v3, v4, v5}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v2

    .line 38
    .local v2, "view":Landroid/view/View;
    sget v3, Lcom/zuimeia_sdk_download/downloadprovider/R$id;->toast_text:I

    invoke-virtual {v2, v3}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 39
    .local v0, "textView":Landroid/widget/TextView;
    invoke-virtual {v0, p1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 40
    new-instance v1, Landroid/widget/Toast;

    invoke-direct {v1, p0}, Landroid/widget/Toast;-><init>(Landroid/content/Context;)V

    .line 41
    .local v1, "toast":Landroid/widget/Toast;
    invoke-static {}, Lcom/zuimeia/sdk/download/utils/ToastUtil;->hasSmartBar()Z

    move-result v3

    if-eqz v3, :cond_35

    .line 42
    const/16 v3, 0xc8

    invoke-virtual {v1, v7, v6, v3}, Landroid/widget/Toast;->setGravity(III)V

    .line 47
    :goto_29
    if-gez p2, :cond_3b

    .line 48
    invoke-virtual {v1, v6}, Landroid/widget/Toast;->setDuration(I)V

    .line 52
    :goto_2e
    invoke-virtual {v1, v2}, Landroid/widget/Toast;->setView(Landroid/view/View;)V

    .line 53
    invoke-virtual {v1}, Landroid/widget/Toast;->show()V

    .line 55
    return-void

    .line 44
    :cond_35
    const/16 v3, 0x64

    invoke-virtual {v1, v7, v6, v3}, Landroid/widget/Toast;->setGravity(III)V

    goto :goto_29

    .line 50
    :cond_3b
    invoke-virtual {v1, p2}, Landroid/widget/Toast;->setDuration(I)V

    goto :goto_2e
.end method
